#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
int Judge(char* name, char* pro)
{
	if (strcmp(pro, "HA") == 0)
	{
		return 1;
	}
	return 0;
}
int main()
{
	int n = 0;
	scanf("%d", &n);
	getchar();
	char name[20] = { 0 };
	char pro[20] = { 0 };
	int count = 0;
	for (int i = 0; i < n; i++)
	{
		scanf("%s%s", name, pro);
		count += Judge(name, pro);
	}
	printf("%d", count);
	
	return 0;
}